package com.sytc.camera.dllinterface;

public enum FX3_FWDWNLOAD_ERROR_CODE {
    SUCCESS(0),
    FAILED(1),
    INVALID_MEDIA_TYPE(2),
    INVALID_FWSIGNATURE(3),
    DEVICE_CREATE_FAILED(4),
    INCORRECT_IMAGE_LENGTH(5),
    INVALID_FILE(6),
    SPILASH_ERASE_FAILED(7),
    CORRUPT_FIRMWARE_IMAGE_FILE(8),
    I2CE2PROM_UNKNOWN_I2C_SIZE(9);

    // 定义一个私有的整数值字段
    private final int value;

    // 构造函数，用于为每个枚举常量赋值
    private FX3_FWDWNLOAD_ERROR_CODE(int value) {
        this.value = value;
    }

    // 获取枚举的整数值
    public int getValue() {
        return this.value;
    }

    // 根据整数值获取枚举常量
    public static FX3_FWDWNLOAD_ERROR_CODE fromInt(int i) {
        for (FX3_FWDWNLOAD_ERROR_CODE code : FX3_FWDWNLOAD_ERROR_CODE.values()) {
            if (code.getValue() == i) {
                return code;
            }
        }
        return null;  // 如果没有匹配的，返回 null 或抛出异常
    }
}
